import ReactDOM from 'react-dom'
import React, { useState } from 'react'

function Com1 () {
  console.log('com1')
  // eslint-disable-next-line no-debugger
  debugger
  const [name, setName] = useState('小花')
  setTimeout(() => {
    setName(() => '小花花')
    console.log(name)
  })
  console.log('com2')

  const [age, setAge] = useState(10)
  const submit = () => {
    console.log(name, age)
  }
  return (
  <>
    <h1>xxx</h1>
    <p>
        <input value={name} onChange={(e) => setName(e.target.value)} />
    </p>
    <p>
        <input value={age} onChange={(e) => setAge(e.target.value)} />
    </p>
    <p>
        <button onClick={submit} >提交</button>
    </p>
  </>)
}

ReactDOM.render(<Com1/>, document.getElementById('root'))
